package com.jy.datapipeline.importserver.mapper;

import com.jy.datapipeline.importserver.entity.ImportSubtask;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

public interface ImportSubtaskMapper {
    int deleteByPrimaryKey(@Param("ids") Long... ids);

    int insert(ImportSubtask record);

    int insertSelective(ImportSubtask record);

    ImportSubtask selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(ImportSubtask record);

    int updateByPrimaryKeyWithBLOBs(ImportSubtask record);

    int updateByPrimaryKey(ImportSubtask record);

    List<ImportSubtask> selectSubtasksByTaskStatus(@Param("subtaskStatus") String subtaskStatus);

    Set<Long> selectIds(@Param("taskIds") Set<String> taskIds);

    Integer lockResource(@Param("ids") Long[] ids);

    Integer selctTryCount(long id);

    int updateSubtaskStatus(@Param("importSubTaskList") List<ImportSubtask> importSubTaskList);

    int getVersion(Long id);

    int updateSubTask(ImportSubtask importSubTask);

    String selectTaskIdById(long id);

    Integer selectFailSubtask(String taskId);

    List<ImportSubtask> selectByPage(@Param("pageNo") Long pageNo, @Param("pageSize") Long pageSize,
                                     @Param("subtaskStatus") String subtaskStatus, @Param("taskId") String taskId,
                                     @Param("trySubtaskLoadCurrentCount") Integer trySubtaskLoadCurrentCount);

    Set<String> selectSubtaskIdByIds(@Param("ids") Long[] ids);

    long selectTotalSizeByTaskId(@Param("taskId") String taskId, @Param("subtaskStatus") String subtaskStatus, @Param("trySubtaskLoadCurrentCount") Integer trySubtaskLoadCurrentCount);

    List<ImportSubtask> selectSubtasksById(@Param("id") Long id);

    Integer selectResource(@Param("ids") Long[] ids);

    ImportSubtask selectSubtaskById(long id);

    int updateSubtaskRetryLoadCount(ImportSubtask importSubtask);

    ImportSubtask selectSubtasks(Long id);

    Integer selectRetryLoadCurrentCount(Long id);

    Integer selectSubtaskStatus(long id);

    int batchDelete(@Param("subtaskIds") Set<String> subtaskIds);

    List<ImportSubtask> selectSubtaskIds(@Param("taskIds") Set<String> taskIds);

    ImportSubtask selectLatestStatus(String taskId);
}